package string;

public class IndexOfDemo {
    //找第一次出现的下标
    public static void main(String[] args) {
        String str = "Thinking in Java";
        int index;
        index = str.indexOf("T");
        System.out.println(index);
        index = str.indexOf("in");
        System.out.println(index);
        index = str.lastIndexOf("in");
        System.out.println(index);
        index = str.indexOf("in",3);
        System.out.println(index);
        index = str.lastIndexOf("in",4);
        System.out.println(index);
    }

}
